home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr48 / 386p_200.zip / VGAREG.ASM < prev    next >
Assembly Source File  |  1995-01-12  |  4KB  |  183 lines

  1. ; 386POWER VGA/SVGA REGISTER DUMP UTILITY
  2. ; It will look what's into the vga registers
  3. ; and will write the results into a text file called vgareg.tbl.
  4. ; Using the following format:
  5. ;
  6. ; [PORT] [INDEX]      [VALUE0] [VALUE1] ..... [VALUEn]
  7. ;  ^       ^internal       ^                      ^register value
  8. ;  |        register       |                       under mode n
  9. ;  |        index          |
  10. ;  |                       register value under the first graphic mode
  11. ;  |                       in the the_mode list
  12. ;  |
  13. ;  i/o port  "index"
  14.  
  15.         .386p
  16.  
  17. code32 segment para public use32
  18.        assume cs:code32,ds:code32
  19.  
  20. include 386power.inc
  21. include 386file.inc
  22.  
  23. public  _Main
  24.  
  25. CR equ 0dh
  26. LF equ 0ah
  27.  
  28. ; DATA
  29. rfile db 'vgatest.tbl',0
  30.  
  31. ; look into the registers of mode
  32. ; 320x200(16)  640x480(2) 640x480(16) 320x200(256) 640x400(256) 640x400(256)
  33.  
  34. modes dd 000Dh,0011h,0012h,0013h,0078h,0079h,0000h
  35.  
  36. ; binary to hexadecimal-ascii conversion table
  37.  
  38. tohex db '0123456789ABCDEF'
  39.  
  40. ; CODE
  41. wbin2hex: ; in eax=WORD to translate , EDI = ptr to dest
  42.         push ecx
  43.         push ebx
  44.         push edx
  45.         mov ecx,4
  46.         rol eax,20
  47. wb2h:
  48.         mov ebx,eax
  49.         and ebx,0Fh
  50.         rol eax,4
  51.         mov dl,[ebx+tohex]
  52.         mov [edi],dl
  53.         inc edi
  54.         dec ecx
  55.         jne  wb2h
  56.         pop edx
  57.         pop ebx
  58.         pop ecx
  59.         ret
  60.  
  61. bbin2hex: ; in eax=BYTE to translate , EDI = ptr to dest
  62.         push ecx
  63.         push ebx
  64.         push edx
  65.         mov ecx,2
  66.         rol eax,28
  67. bb2h:
  68.         mov ebx,eax
  69.         and ebx,0Fh
  70.         rol eax,4
  71.         mov dl,[ebx+tohex]
  72.         mov [edi],dl
  73.         inc edi
  74.         dec ecx
  75.         jne  wb2h
  76.         pop edx
  77.         pop ebx
  78.         pop ecx
  79.         ret
  80.  
  81. rcycle:
  82.         ; ecx=port count/index
  83.         ; edx=base port
  84.         ; edi=text destination, ebx = line width
  85. zook:   dec ecx
  86.         mov al,cl
  87.         out dx,al
  88.         inc edx
  89.         in al,dx
  90.         dec edx
  91.         push edi
  92.         call bbin2hex
  93.         mov dword ptr [edi],200A0D20h
  94.         pop edi
  95.         add edi,ebx
  96.         or ecx,ecx
  97.         jne zook
  98.         ret
  99.  
  100. chokk:  push edi
  101.         push ecx
  102.         sub edi,ebp
  103. czook:  dec ecx
  104.         push edi
  105.         mov byte ptr [edi],' '
  106.         inc edi
  107.         mov eax,edx
  108.         call wbin2hex
  109.         mov byte ptr [edi],' '
  110.         inc edi
  111.         mov al,cl
  112.         call bbin2hex
  113.         mov dword ptr [edi],20202020h
  114.         pop edi
  115.         add edi,ebx
  116.         or ecx,ecx
  117.         jne czook
  118.         pop ecx
  119.         pop edi
  120.         call rcycle
  121.         ret
  122. ;═════════════════════════════════════════════════════════════════════════════
  123. _Main:  
  124.         sti
  125.         mov ebp,12
  126.         mov esi,offset modes
  127.         mov ebx,(12+3+3+3+3+3+3+2) ; 6 lists with cr+lf on last list
  128. ricicla:
  129.         lodsd            ; read mode to test
  130.         or eax,eax       ;
  131.         je end_of_table  ;
  132.  
  133.         mov edi,_LoMemBase  ; restart from start of table
  134.         add edi,ebp         ; move to the new column to fill
  135.  
  136.         mov V86eax,eax  ; set graphic mode
  137.         mov al,10h      ;
  138.         call _ExecINT         ;
  139.  
  140.         ; Now scan the register values (current settings are for peeking into)
  141.         ; my Chips&Technologies video card
  142.         ; change the base ports and internal register ranges
  143.         ; to read what's in your card.
  144.  
  145.         mov edx,3c0h  ; test registers accessible from 3c0/1
  146.         mov ecx,20h   ; test 32 registers
  147.         call chokk
  148.  
  149.         mov edx,3c4h  ;
  150.         mov ecx,20h   ;
  151.         call chokk
  152.  
  153.         mov edx,3ceh  ;
  154.         mov ecx,20h   ;
  155.         call chokk
  156.  
  157.         mov edx,3d4h  ;
  158.         mov ecx,30h   ;
  159.         call chokk
  160.  
  161.         mov edx,3d6h  ; test C&T 450 specific registers
  162.         mov ecx,30h   ;
  163.         call chokk    ; (change this to suit to your board's extensions )
  164.  
  165.         add ebp,3
  166.  
  167.         jmp short ricicla
  168. end_of_table:
  169.         mov eax,edi
  170.         mov edi,_LoMemBase
  171.         sub eax,edi
  172.         mov esi,offset rfile
  173.         call _FSave
  174.         mov V86eax,0003h
  175.         mov al,10h
  176.         call _ExecINT
  177.         jmp _Exit
  178.  
  179.  
  180. code32  ends
  181.         end
  182.  
  183.